package com.elune.ui;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.lzy.okgo.R;


public class ConnectionToast {
    public static void ToastShowBottom(Context context, String str) {

        if (context != null && str != null && str.length() > 0) {

            if (context == null) {
                return;
            }
            View view = LayoutInflater.from(context)
                    .inflate(R.layout.alert_toast, null);
            TextView txt = (TextView) view.findViewById(R.id.alert_toast);
            txt.setText(str);
            if (context == null) {
                return;
            }
            Toast toast = new Toast(context);
            toast.setGravity(Gravity.BOTTOM, 0, 150);
            toast.setDuration(Toast.LENGTH_SHORT);
            toast.setView(view);
            toast.show();
        }
    }



    public static void ToastShowMid(Context context, String str) {
        if (context != null && str != null && str.length() > 0) {
            if (context == null) {
                return;
            }
            View view = LayoutInflater.from(context)
                    .inflate(R.layout.alert_toast, null);

            // Toast toast = ConnectionToast.ToastShowBottom(context, str, Toast.LENGTH_SHORT);
            TextView txt = (TextView) view.findViewById(R.id.alert_toast);
            txt.setText(str);
            if (context == null) {
                return;
            }
            Toast toast = new Toast(context);
            toast.setGravity(Gravity.CENTER, 0, 150);
            toast.setDuration(Toast.LENGTH_LONG);
            toast.setView(view);
            toast.show();
        }
    }


}
